//
//  MPITreeTypes.h
//  PIDAMRX
//
//  Created by Patrick Zulian on 4/6/11.
//  Copyright 2011 ICS - USI - Lugano. All rights reserved.
//

#ifndef PIDAMRX_MPITreeTypes_H
#define PIDAMRX_MPITreeTypes_H


#include <mpi.h>

#include "TreeTypes.h"

namespace nsesolver {
    
    template< class _Bound >
    struct mpi_extension {
    public:
        typedef _Bound Bound;
        typedef long NodeId;
        
        Bound spanningBound;
        NodeId nodeId;
        
        MPI_Datatype NodeIdMpiType;
        
        mpi_extension() 
        : spanningBound(Bound::CreateEmpty()),  nodeId(-1), NodeIdMpiType(MPI_LONG)
        {}
    };
    
    
    
    template< class DataType >
    struct mpi_octree_traits : public tree_default_traits< DataType, mpi_octree_traits< DataType > >{
    public:
        typedef AABB< 3, double > Bound;
        typedef struct mpi_extension< Bound > Extension;
    };
    
    
    template < class T >
    class MPIOctree : public Tree< T, mpi_octree_traits< T > > {
    private:
        typedef Tree< T, mpi_octree_traits< T > > Tree;
    public:
        MPIOctree(const AABB< 3, double > &aabb )
        : Tree(aabb) 
        {}
        
        
    };
    
    
    
}



#endif //PIDAMRX_MPITreeTypes_H
